Skip to content

Fix Sign and Submit lifecycle and dispatch error handling#37

Closed
itsyogesh wants to merge 2 commits intofeat/contract-studiofrom
fix/builder-tx-lifecycle
Closed

Fix Sign and Submit lifecycle and dispatch error handling#37
itsyogesh wants to merge 2 commits intofeat/contract-studiofrom
fix/builder-tx-lifecycle

Conversation

@itsyogesh
Copy link
Copy Markdown
Owner

Summary

Fixes two issues with the builder's transaction submission flow:

  • Sign and Submit button gets stuck: Replaced LunoKit's isPending with local isSubmitting state managed via try/finally, so the button always resets even if the wallet extension hangs or the popup is dismissed without action.
  • Dispatch errors shown as success: After block inclusion, receipt.status is now checked — failed dispatches (e.g. pallet errors from mapAccount) surface the actual error message instead of showing a false "Transaction included in block" toast.

Changes

  1. Builder (extrinsic-builder.tsx): Local isSubmitting state, spinner on button, improved signing toast, user rejection detection, dispatch error check on receipt.status
  2. Studio deploy (deploy-section.tsx): Same dispatch error check, signing feedback in transaction log, user rejection distinguished from errors
  3. Test update: Updated existing test to match new button state management

Test plan

  • Sign and Submit → approve in wallet → success toast with block hash
  • Sign and Submit → reject in wallet → "Transaction cancelled by user" (not error)
  • Sign and Submit → close wallet popup → button resets to "Sign and Submit"
  • Submit tx that fails on-chain (e.g. mapAccount when already mapped) → error toast with dispatch error details
  • Studio deploy same flows via transaction log
  • yarn test passes

- Replace LunoKit's isPending with local isSubmitting state managed in
  try/finally, ensuring the button always resets even if the wallet
  interaction hangs or the extension crashes
- Add spinner icon to submitting state for clearer feedback
- Improve signing toast to prompt user to approve in wallet extension
- Distinguish user rejection (cancelled/rejected) from actual errors
  with appropriate toast messages
- Check receipt.status === "failed" after block inclusion to surface
  on-chain dispatch errors (e.g., module errors from pallet-revive)
  instead of showing a false success toast
- Add "Signing... approve in your wallet extension" log entry in Studio
  deploy section for intermediate feedback
- Distinguish user wallet rejection from actual transaction errors in
  Studio deploy log (info vs error)
@vercel
Copy link
Copy Markdown
Contributor

vercel bot commented Mar 20, 2026

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated (UTC)
relaycode Ready Ready Preview, Comment Mar 20, 2026 4:29am

Request Review

@itsyogesh
Copy link
Copy Markdown
Owner Author

Changes already merged to master via PR #36 (feat/contract-studio). Closing as superseded.

@itsyogesh itsyogesh closed this Mar 20, 2026
@itsyogesh itsyogesh reopened this Mar 20, 2026
@itsyogesh itsyogesh closed this Mar 20, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant